#restart.sh
#!/bin/bash
#NAME=pigx-register
NAME=$1
SERVER_FOLDER=/work/release/iecg/server
SERVER_NAME=$SERVER_FOLDER/$NAME.jar
SERVER_LOG=$SERVER_FOLDER/$NAME.log

echo "Restarting SpringBoot Application"
echo "sever name:" $SERVER_NAME
pid=`/bin/ps -ef | grep ${NAME} | grep java | awk '{print $2}'`
echo "pid:"$pid
if [ -n "$pid" ]
then
   kill -9 $pid
   echo "[$SERVER_NAME][$pid]>>>>>>>kill"
fi

echo ">>>>>>server start------[$SERVER_NAME]>>>>>>>>>>>>>>>>>>>>>>"
nohup /work/server/java/jdk1.8.0_40/bin/java -jar $SERVER_NAME  >$SERVER_LOG&
echo ">>>>>>>>>>>>>>>>>>>>server finish-------[$SERVER_NAME]>>>>>>>>>>>>>>>>>>>>>>>"

